myApp.factory("postMealReview",function($http, $q, $cookies) {
   
    return {
        postReview : postReview
    };
   
    function postReview(data){
        var deferred = $q.defer();
        var userCookie = JSON.parse($cookies.userCookie);
        return $http({
            method : 'POST',
            url    : 'api/mealreview/' + data.mealId,
            headers: {
                'username': userCookie.name,
                'usertype': userCookie.type
            },
            data : data
        }).success(function(respData) {
            deferred.resolve(respData);			
        }).error(function(errorData) {
            console.log("Error while retriving users. Error: " + errorData.ex );
        //commonService.showErrorMessage(errorData ,"Error while receiving project details.");
        });
        return deferred.promise;
    };
});